import fetch from '../config/fetch'
import {fetchJson,fetchForm} from '../config/fetch'
import {GetQueryString} from '../config/common.js'


export let sessionid=GetQueryString('sessionid')

//mine/index
//判断是否创建名帖(根据当前用户获取名帖)
export const isCreateCard = () => fetch('/card/findCardByUid', {
	uid:sessionStorage.uid
},'GET');


//mine/index/tips
//获取标签
export const getTips = (itype) => fetch('/tag/listSystemTag',{
	itype:itype,
	pageSize:100
},'GET');

//mine/index/industry
//获取行业
export const getIndustry = (ctype) => fetch('/dictionary/listDict',{
	ctype:ctype,
	pageSize:100
},'GET')

//mine/index/addCard
//添加名帖
export const addCard = (data) => fetchForm('/card/saveCard',data,'POST')

//mine/index/receiveCard
//可认领列表
export const receiveCard = () => fetch('/card/listCardByFullText',{pageNo:1,pageSize:100000000},'GET')

//mine/index/receiveCard
//提交认领
export const toReceive = (id) => fetch('/claim/claimCard',{cardid:id},'POST')

//mine/index/collectTerm
//创建分组
export const createTerm = (val) => fetch('/collectgroup/saveGroup',{cname:val},'POST')

//mine/index/collectTerm
//分组列表
export const collectTerm = () => fetch('/collectgroup/listCardByGroup',{pageNo:1,pageSize:100},'GET')

//mine/index/collectTerm
//收藏名帖列表
export const collectList = (pageNo=1) => fetch('/collect/listCollect',{pageNo:pageNo,pageSize:10},'GET')

//mine/index/collectTerm
//删除分组
export const deleteTerm = (id) => fetch('/collectgroup/deleteGroup',{ids:id},'POST')

//mine/index/collectTerm
//名帖导入分组
export const toIncludeTerm = (id,ids) => fetch('/collectgroup/intoGroupByCard',{groupid:id,ids:ids},'POST')

//mine/index/myCollect
//推荐
export const recommendCard = (icardid,irecommenduid) => fetch('/recommend/recommendCard',{icardid:icardid,irecommenduid:irecommenduid},'POST')

//mine/index/collectTerm
//取消收藏
export const removeCard = (id) => fetch('/collect/removeCollect',{ids:id},'POST')

//mine/index/collectTerm
//交换
export const exchangeCard = (id,beuid,beid) => fetch('/exchange/exchangeCard',{icardid:id,iexchangeuid:beuid,iexchangecid:beid},'POST')

//mine/index/editDetail
//根据id获取名帖
export const getCardById = (id) => fetch('/card/detailsCard',{id:id},'GET')

//mine/index/exchange
//交换
export const getMyExChangeList = (uid,pageNo) => fetch('/exchange/listExchange',{pageNo:pageNo,pageSize:10,uid:uid},'GET')

//mine/index/exchange
//被交换
export const getBeExChangeList = (uid,pageNo) => fetch('/exchange/listExchange',{pageNo:pageNo,pageSize:10,iexchangeuid:uid},'GET')

//mine/index/exchange
//确认交换
export const sureExchange = (id) => fetch('/exchange/confirmExchange',{ids:id},'POST')

//mine/index/myArt
//获取文章列表
export const getArtList = (uid,pageNo) => fetch('/article/listArticle',{pageNo:pageNo,pageSize:10,uid:uid,itype:0},'GET')

//mine/index/myArt
//
export const deleteArt = (id) => fetch('/article/deleteArticleByUid',{ids :id},'POST')

//mine/index/mytalk
//接受消息列表
export const messages = (pageNo) => fetch('/blog/listBlog',{pageNo:pageNo,pageSize:10},'GET')

//mine/index/mytalk
//回复
export const reply = (content,ireplyid) => fetch('/blog/saveBlog',{content:content,ireplyid:ireplyid},'POST')

//mine/index/invate
//邀请我的列表
export const inviteMeList = (content,ireplyid) => fetch('/invite/getInviteByUid',{},'POST')

//mine/index/invate
//我邀请的列表
export const inviteList = (content,ireplyid) => fetch('/invite/getInviteBySelf',{},'POST')

//mine/index/invate
//接受邀请
export const sureInviteMe = (ids) => fetch('/invite/confirmInvite',{ids:ids},'POST')

//撤销邀请
export const delInvite = (ids) => fetch('/invite/removeInviteByUid',{ids:ids},'POST')

//mine/index/my
//推荐列表(分页)
export const recommendLists = (pageNo) => fetch('/recommend/listRecommend',{uid:sessionStorage.uid,pageNo:pageNo,pageSize:10},'GET')

//mine/index/my
//推荐列表(分页)
export const recommendListsAll = () => fetch('/recommend/listRecommend',{uid:sessionStorage.uid,pageNo:1,pageSize:1000000000},'GET')

//mine/index/my
//被推荐列表
export const beRecommendLists = (pageNo) => fetch('/recommend/listRecommend',{irecommenduid:sessionStorage.uid,pageNo:pageNo,pageSize:10},'GET')


//mine/index/my
//我的关注列表
export const followList = (pageNo,findContent) => fetch('/focuson/listFocusOn',{uid:sessionStorage.uid,pageNo:pageNo,pageSize:10,findContent:findContent},'GET')

//mine/index/my
//粉丝列表
export const followMeList = (pageNo,findContent) => fetch('/focuson/listFocusOn',{ifocusuid:sessionStorage.uid,pageNo:pageNo,pageSize:10,findContent:findContent},'GET')

//mine/index/my
//取消关注
export const removeFollow = (ids) => fetch('/focuson/removeFocusOn',{ids:ids},'POST')

//mine/index/myGood
export const goodList = (pageNo) => fetch('/product/listProduct',{uid:sessionStorage.uid,pageNo:pageNo,pageSize:10},'GET')

//mine/index/myGood
//删除产品
export const delPro = (ids) =>fetch('/product/deleteProduct',{ids:ids},'POST')

//trend
//删除动态
export const delArt = (ids) =>fetch('/article/deleteArticleByUid',{ids:ids},'POST')

//发布文章
export const tosendArt = (data) =>fetchForm('/article/saveArticle',data,'POST')

//根据id获取文章
export const getArtDetail = (id) =>fetch('/article/detailsArticle',{id:id},'GET')